/**
 * caicongyang.com Inc.
 * Copyright (c) 2004-2017 All Rights Reserved.
 */
package com.caicongyang.design.clone;

/**
 *
 * 深拷贝：深复制把要复制的对象所引用的对象都复制了一遍
 * @author caicongyang1
 * @version id: Student, v 0.1 17/5/13 下午8:47 caicongyang1 Exp $$
 */
public class Student implements Cloneable {

    private String    name;

    private Integer   age;

    private Professor professor;

    public Student(String name, Integer age, Professor professor) {
        this.name = name;
        this.age = age;
        this.professor = professor;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        Student stu = (Student) super.clone();
        stu.professor = (Professor) professor.clone();
        return stu;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Professor getProfessor() {
        return professor;
    }

    public void setProfessor(Professor professor) {
        this.professor = professor;
    }
}
